package com.tx.framework.datasource;

import java.util.List;
import java.util.Map;

import com.tx.framework.entity.BaseEntity;

public interface BaseService<T extends BaseEntity> {

	int deleteByPrimaryKey(T t);

	int delete(T t);

	int deleteByExample(Object example);

	// boolean insert(T t);

	int insertSelective(T t);

	boolean existsWithPrimaryKey(T t);

	List<T> selectAll();

	T selectByPrimaryKey(T t);

	int selectCount(T t);

	List<T> select(T t);

	T selectOne(T t);

	// int updateByPrimaryKey(T t);

	int updateByPrimaryKeySelective(T t);

	int insertList(List<? extends T> list);

	List<T> selectByExample(Object obj);

	T selectOneByExample(Object obj);

	int updateByExampleSelective(T t, Object example);

	// List<T> getListByTwoCompanys(Class<T> clas,Integer companyId,String
	// fieldName,String value);

	// List<T> getListByTwoCompanys(Class<T> clas,Integer companyId,String
	// fieldName,String value,Integer notEqualId);

	// List<T> getListByTwoCompanys(Class<T> clas,Integer companyId);

	void updateByConditionSelective(T t, Map<String, Object> conditionMap);

	Map<String, Object> getConditionMap();

	Boolean addCheckIsExists(String fieldName, String fieldValue,
			Integer companyId, Class<T> clas);

	Boolean editCheckIsExists(Integer id, String fieldName, String fieldValue,
			Integer companyId, Class<T> clas);

	/**
	 * 金额保存指定位数，四舍五入
	 * 
	 * @param money
	 *            总金额
	 * @param pointNumber
	 *            小数位，比如：2
	 * @return
	 */
	String getMoney(Integer money, Integer pointNumber);
}
